export default class Uploads{

 host_ip="10.7.5.88"
 uploadMapData = function () {
  //获取地图文件名称，通过.tar.gz来分割文件名称，存在一定风险
  var file2upload = document.getElementById("gs_MapName").files[0];
  var map_name = file2upload.name.split('.tar.gz', 1);
  var url = "http://" + host_ip + ":8080/gs-robot/data/upload_map?map_name=" + map_name;

  var xhr = new XMLHttpRequest();
  xhr.withCredentials = false;
  xhr.open("POST", url);

  xhr.addEventListener("readystatechange", function () {
    if (this.readyState === 4) {
      if (this.status == 200) {
        document.getElementById("upMap").disabled = false;
        this.$message.success('上传地图成功')

      }else{
        this.$message.error('上传地图失败')
      }
  
    }
  });

};
}